home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
56804
/
56804.xpi
/
chrome
/
content
/
seostatus.js
< prev
next >
Wrap
Text File
|
2010-01-31
|
5KB
|
132 lines
if(!com) var com={};
if(!com.seostatus) com.seostatus={};
com.seostatus.seostatus = function(){
var pub = {};
pub.customButtonClicked = function(){
var mainBar = document.getElementById('SEOTB-Toolbar');
var onOrOff = mainBar.hidden;
mainBar.setAttribute("hidden", !onOrOff);
}
////////////////////////////////////////////////////////////////////////////////
// The SEOTB_Search() function will perform a Google search for us. The two
// parameters that get passed in are the event that triggered this function
// call, and the type of search to perform.
////////////////////////////////////////////////////////////////////////////////
pub.SEOPageRank_Action = function(event, type)
{
// This variable will hold the URL we will browse to
var URL = "";
var isEmpty = false;
if (content.document.location.length < 12) {isEmpty = true; }
switch(type)
{
// Build up the URL for an image search
case "value":
if(isEmpty) { URL = "http://www.rubyweb.org/"; }
else { URL = "http://www.sitevaluecalculator.com/result.php?domain=" + escape(content.document.location) + "&ref=stb"; }
break;
case "whois":
if(isEmpty) { URL = "http://www.rubyweb.org/"; }
else { URL = "http://www.rapidsitecheck.com/whois.php?domain=" + escape(content.document.location) + "&ref=stb"; }
break;
case "backlinks":
if(isEmpty) { URL = "http://www.rubyweb.org/"; }
else { URL = "http://www.rapidsitecheck.com/pagerank-backlinks.php?domain=" + escape(content.document.location) + "&ref=stb"; }
break;
case "dynamicdomain":
if(isEmpty) { URL = "http://www.rubyweb.org/"; }
else { URL = "http://www.rapidsitecheck.com/domain-lookup.php?domain=" + escape(content.document.location) + "&ref=stb" +
"&net=true&us=true&org=true&info=true&biz=true"; }
break;
case "dig":
if(isEmpty) { URL = "http://www.rubyweb.org/"; }
else { URL = "http://www.rapidsitecheck.com/all-datacenters.php?domain=" + escape(content.document.location) + "&ref=stb"; }
break;
case "alexa":
if(isEmpty) { URL = "http://www.alexa.com/"; }
else { URL = "http://www.alexa.com/data/details/traffic_details?q=&url=" + escape(content.document.location) + "&ref=stb"; }
break;
case "google":
if(isEmpty) { URL = "http://www.google.com/"; }
else { URL = "http://www.google.com/search?q=cache%3A" + escape(content.document.location) + "&ref=stb"; }
break;
}
// Load the URL in the browser window using the goto_page function
pub.goto_page(URL);
}
////////////////////////////////////////////////////////////////////////////////
// The SEOTB_TrimString() function will trim all leading and trailing whitespace
// from the incoming string, and convert all runs of more than one whitespace
// character into a single space. The altered string gets returned.
////////////////////////////////////////////////////////////////////////////////
pub.SEOTB_TrimString = function(string)
{
// If the incoming string is invalid, or nothing was passed in, return empty
if (!string)
return "";
string = string.replace(/^\s+/, ''); // Remove leading whitespace
string = string.replace(/\s+$/, ''); // Remove trailing whitespace
// Replace all whitespace runs with a single space
string = string.replace(/\s+/g, ' ');
return string; // Return the altered value
}
////////////////////////////////////////////////////////////////////////////////
// The goto_page() function loads the specified URL in the browser.
////////////////////////////////////////////////////////////////////////////////
pub.goto_page = function(url)
{
// Set the browser window's location to the incoming URL
window._content.document.location = url;
// Make sure that we get the focus
window.content.focus();
}
////////////////////////////////////////////////////////////////////////////////
// The SEOTB_KeyHandler() function checks to see if the key that was pressed
// is the [Enter] key. If it is, a web search is performed.
////////////////////////////////////////////////////////////////////////////////
pub.SEOTB_KeyHandler = function(event)
{
// Was the key that was pressed [ENTER]? If so, perform a web search.
if(event.keyCode == event.DOM_VK_RETURN)
pub.SEOPageRank_Action(event, 'web');
}
pub.showOptions = function()
{
window.openDialog( "chrome://seostatus/content/options.xul", "seostatus-options-dialog", "centerscreen,chrome,modal" );
}
pub.showAbout = function()
{
window.openDialog( "chrome://seostatus/content/about.xul", "seostatus-about-dialog", "centerscreen,chrome,modal" );
}
return pub;
}();